import { get, post } from '../http'

// 获取组织架构
export const getOrganizes = (paylaod?: any) => {
  return get('/user/v1/dept/getOrganizes', paylaod)
}
// 获取组织架构人数
export const getOrganizeUserNum = (paylaod?: any) => {
  return get('/user/v1/dept/getOrganizeUserNum', paylaod)
}
// 新增部门
export const createDept = (paylaod: any) => {
  return post('/user/v1/dept/createDept', paylaod)
}
// 更新部门
export const updateDept = (paylaod: any) => {
  return post('/user/v1/dept/updateDept', paylaod)
}
// 删除部门
export const deleteDept = (paylaod: any) => {
  return post('/user/v1/dept/deleteDept', paylaod)
}
// 获取部门管理员
export const getDeptManagers = (paylaod: any) => {
  return get('/user/v1/dept/getDeptManagers', paylaod)
}
// 获取部门其他人员
export const getDeptOther = (paylaod: any) => {
  return get('/user/v1/dept/getDeptOthers', paylaod)
}
// 更新部门主管
export const updateDeptManagers = (paylaod: any) => {
  return post('/user/v1/dept/updateDeptManagers', paylaod)
}
// 更新跨部门人员
export const updateDeptOthers = (paylaod: any) => {
  return post('/user/v1/dept/updateDeptOthers', paylaod)
}

// 根据组织获取用户
export const getOrganizesUser = (paylaod?: any) => {
  return get('/user/v1/user/getOrganizesUser', paylaod)
}
// 新增用户
export const createUser = (paylaod?: any) => {
  return post('/user/v1/user/createUser', paylaod)
}
// 更新用户
export const updateUser = (paylaod?: any) => {
  return post('/user/v1/user/updateUser', paylaod)
}
// 更新用户密码
export const updateUserPwd = (paylaod?: any) => {
  return post('/user/v1/user/updateUserPwd', paylaod)
}

// 根据角色获取用户
export const getUserByRole = (paylaod?: any) => {
  return get('/user/v1/role/getUserByRole', paylaod)
}
// 角色绑定用户
export const roleBindUser = (paylaod: any) => {
  return post('/user/v1/role/roleBindUser', paylaod)
}
// 角色解绑用户
export const roleUnbindUser = (paylaod: any) => {
  return post('/user/v1/role/roleUnbindUser', paylaod)
}
// 查询角色-不分页
export const findRoleListByParam = (paylaod?: any) => {
  return get('/user/v1/role/findRoleListByParam', paylaod)
}

// 查询岗位
export const listPosition = (paylaod?: any) => {
  return get('/user/v1/position/listPosition', paylaod)
}
// 更新职位
export const updatePosition = (paylaod?: any) => {
  return post('/user/v1/position/updatePosition', paylaod)
}
// 删除职位
export const deletePosition = (paylaod?: any) => {
  return post('/user/v1/position/deletePosition', paylaod)
}
// 添加岗位
export const createPosition = (paylaod?: any) => {
  return post('/user/v1/position/createPosition', paylaod)
}

// 查询店铺列表
export const findShopPageByParam = (paylaod?: any) => {
  return get('/user/v1/shop/findShopPageByParam', paylaod)
}
// 查询店铺列表
export const countShopMarketByParam = (paylaod?: any) => {
  return get('/user/v1/shop/countShopMarketByParam', paylaod)
}
// 根据地区获取站点
export const getShopMarketByRegion = (paylaod?: any) => {
  return get('/user/v1/shop/getShopMarketByRegion', paylaod)
}
// 新增店铺
export const createShop = (paylaod?: any) => {
  return post('/user/v1/shop/createShop', paylaod)
}
// 更新店铺基础信息（批量设置店长、品牌）
export const updateShopBase = (paylaod?: any) => {
  return post('/user/v1/shop/updateShopBase', paylaod)
}
// 更新店铺站点信息批量（批量设置店员、启用、停用）
export const updateShopMarketBatch = (paylaod?: any) => {
  return post('/user/v1/shop/updateShopMarketBatch', paylaod)
}
// 获取店铺详情
export const getShopInfo = (paylaod?: any) => {
  return get('/user/v1/shop/getShopInfo', paylaod)
}
// 更新店铺站点信息批量
export const updateShopMarkets = (paylaod?: any) => {
  return post('/user/v1/shop/updateShopMarkets', paylaod)
}
// 更新店铺注册信息批量
export const updateShopRegister = (paylaod?: any) => {
  return post('/user/v1/shop/updateShopRegister', paylaod)
}
// 获取亚马逊Pii授权地址(隐私授权地址)
export const getAmazonPiiAuthUrl = (paylaod?: any) => {
  return get('/user/v1/shop/getAmazonPiiAuthUrl', paylaod)
}
// 获取亚马逊广告授权地址
export const getAmazonAdAuthUrl = (paylaod?: any) => {
  return get('/user/v1/shop/getAmazonAdAuthUrl', paylaod)
}
// 新增店铺站点批量
export const createShopMarketBatch = (paylaod?: any) => {
  return post('/user/v1/shop/createShopMarketBatch', paylaod)
}
// 更新店铺企业注册信息
export const updateShopEnterprise = (paylaod?: any) => {
  return post('/user/v1/shop/updateShopEnterprise', paylaod)
}
// 查询所有站点-不分页
export const getShopMarketAll = (paylaod?: any) => {
  return get('/user/v1/shop/getShopMarketAll', paylaod)
}
// 查询店铺-不分页
export const findShopListByParam = (paylaod?: any) => {
  return get('/user/v1/shop/findShopListByParam', paylaod)
}
// 查询店铺站点-不分页
export const findShopMarketByParam = (paylaod?: any) => {
  return get('/user/v1/shop/findShopMarketByParam', paylaod)
}
// 查询店铺站点-不分页-包含共享店铺
export const findShopMarketAndShareByParam = (paylaod?: any) => {
  return get('/user/v1/shop/findShopMarketAndShareByParam', paylaod)
}
// 同步erp店铺到saas
export const syncErpShopInfo = (paylaod?: any) => {
  return post('/user/v1/shop/syncErpShopInfo', paylaod)
}
// 根据店铺查询用户的
export const getShopMarketAndUserInfo = (paylaod?: any) => {
  return get('/user/v1/shop/getShopMarketAndUserInfo', paylaod)
}

// -------------------------------汇率管理-----------------------------

// 查询汇率列表-不分页
export const findExchangeRateList = (paylaod?: any) => {
  return get('/user/v1/exchange/rate/findExchangeRateList', paylaod)
}
// 更新汇率
export const updateExchangeRate = (paylaod?: any) => {
  return post('/user/v1/exchange/rate/updateExchangeRate', paylaod)
}
// 同步汇率
export const manualSyncExchangeRate = (paylaod?: any) => {
  return post('/user/v1/exchange/rate/manualSyncExchangeRate', paylaod)
}

// 查询功能权限
export const getFuncPermisson = (paylaod?: any) => {
  return get('/user/v1/funPermission/getFuncPermisson', paylaod)
}
// 查询功能权限列表
export const listMenuFuncs = (paylaod?: any) => {
  return get('/user/v1/funPermission/listMenuFuncs', paylaod)
}
// 新增或者更新功能权限
export const saveOrUpdateFuncPermisson = (paylaod?: any) => {
  return post('/user/v1/funPermission/saveOrUpdateFuncPermisson', paylaod)
}
// 数据权限组列表
export const pageDataPermissonGroup = (paylaod?: any) => {
  return get('/user/v1/dataPermission/pageDataPermissonGroup', paylaod)
}

// 新增或者更新数据权限列表分组
export const saveOrUpdateDataPermissonGroup = (paylaod?: any) => {
  return post('/user/v1/dataPermission/saveOrUpdateDataPermissonGroup', paylaod)
}

// 批量启用或禁用
export const updateEnable = (paylaod?: any) => {
  return post('/user/v1/dataPermission/updateEnable', paylaod)
}

// 查询数据权限组详情
export const getDataPermissonGroup = (paylaod?: any) => {
  return get('/user/v1/dataPermission/getDataPermissonGroup', paylaod)
}

// 获取组织架构树
export const getOrganizesWithUser = (paylaod?: any) => {
  return get('/user/v1/dept/getOrganizesWithUser', paylaod)
}

// 添加角色
export const createRole = (paylaod?: any) => {
  return post('/user/v1/role/createRole', paylaod)
}
// 编辑角色
export const updateRole = (paylaod?: any) => {
  return post('/user/v1/role/updateRole', paylaod)
}
// 删除角色
export const deleteRole = (paylaod?: any) => {
  return post('/user/v1/role/deleteRole', paylaod)
}

// 复制权限组 /user/v1/dataPermission/copyDataPermissonGroup
export const copyDataPermissonGroup = (paylaod?: any) => {
  return post('/user/v1/dataPermission/copyDataPermissonGroup', paylaod)
}

// 删除权限组 /user/v1/dataPermission/removeDataPermissonGroup
export const removeDataPermissonGroup = (paylaod?: any) => {
  return post('/user/v1/dataPermission/removeDataPermissonGroup', paylaod)
}

// 供应商注册-外部
export const registerSupplierOutter = (paylaod?: any) => {
  return post('/user/v1/companyAppRegister/registerSupplierOutter', paylaod)
}
// 供应商注册-内部
export const registerSupplierInner = (paylaod?: any) => {
  return post('/user/v1/companyAppRegister/registerSupplierInner', paylaod)
}
// 服务商注册-外部
export const registerServicerOutter = (paylaod?: any) => {
  return post('/user/v1/companyAppRegister/registerServicerOutter', paylaod)
}
// 服务商注册-内部
export const registerServicerInner = (paylaod?: any) => {
  return post('/user/v1/companyAppRegister/registerServicerInner', paylaod)
}
// 公司简称是否存在
export const isCompanyShortNameExist = (paylaod?: any) => {
  return post('/user/v1/companyAppRegister/isCompanyShortNameExist', paylaod)
}
// 社会应用社代码是否存在
export const isSocialCreditCodeExist = (paylaod?: any) => {
  return post('/user/v1/companyAppRegister/isSocialCreditCodeExist', paylaod)
}
// 根据编号查询租户
export const getCompanyByCode = (paylaod?: any) => {
  return get('/user/v1/company/getCompanyByCode', paylaod)
}
// 获取当前租户信息
export const getCurrentCompany = async (paylaod?: any) => {
  return await get('/user/v1/company/getCurrentCompany', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 租户开启对外采购服务
export const openCompanyOutPurchase = async (paylaod?: any) => {
  return await post('/user/v1/company/openCompanyOutPurchase', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 用户中心数据
export const getUserCenter = (paylaod?: any) => {
  return get('/user/v1/user/getUserCenter', paylaod)
}

// 更该用户手机号
export const updateUserMobile = (paylaod?: any) => {
  return post('/user/v1/user/updateUserMobile', paylaod)
}

// 更新用户手机号
export const updateUserHeaderImage = (paylaod?: any) => {
  return post('/user/v1/user/updateUserHeaderImage', paylaod)
}

// 查询店铺--无权限
export const findShopMarketByNoPermission = (paylaod?: any) => {
  return get('/user/v1/shop/findShopMarketByNoPermission', paylaod)
}
// 查询仓库--无权限
export const findWarehouseListByNoPermission = (payload?: any) => {
  return get('/inventory/v1/warehouse/findWarehouseListByNoPermission', payload)
}
// 查询供应商--无权限
export const findSupperListByNoPermission = (paylaod?: any) => {
  return get('/user/v1/supplier/findSupperListByNoPermission', paylaod)
}
// 供应商列表-不分页
export const findSupperList = (paylaod?: any) => {
  return get('/user/v1/supplier/findSupperList', paylaod)
}
// 查询用户--无权限
export const getOrganizesWithUserByNoPermission = (paylaod?: any) => {
  return get('/user/v1/dept/getOrganizesWithUserByNoPermission', paylaod)
}

// 下载中心列表
export const pageDownloadCenter = (payload?: any) => {
  return get('/user/v1/downloadCenter/pageDownloadCenter', payload)
}
// 删除下载中心数据
export const delDownloadCenter = (payload?: any) => {
  return post('/user/v1/downloadCenter/delDownloadCenter', payload)
}
// 下载次数加一
export const incDownloadNum = (payload?: any) => {
  return post('/user/v1/downloadCenter/incDownloadNum', payload)
}

// 初始化账户钱包
export const initWallterAccounts = (payload?: any) => {
  return post('/finance/v1/wallet/CompanyAccount/initWallterAccounts', payload)
}

// 更改wordPress店铺状态
export const updateShopBaseV2 = (payload?: any) => {
  return post('/user/v1/shop/updateShopBaseV2', payload)
}

// 批量设置店长和品牌
export const updateShopBaseBatch = (payload?: any) => {
  return post('/user/v1/shop/updateShopBaseBatch', payload)
}
// -----------------------角色------------------------

// 根据角色获取部门
export const getDeptByRole = async (paylaod?: any) => {
  return await get('/user/v1/role/getDeptByRole', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 角色绑定部门
export const roleBindDept = async (paylaod?: any) => {
  return await post('/user/v1/role/roleBindDept', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 角色绑定部门
export const roleUnbindDept = async (paylaod?: any) => {
  return await post('/user/v1/role/roleUnbindDept', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// -----------------------材质报价------------------------
// 材质报价列表
export const findMaterialQuotePage = async (paylaod?: any) => {
  return await get('/user/v1/materialQuote/findMaterialQuotePage', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 新增材质报价
export const createMaterialQuote = async (paylaod?: any) => {
  return await post('/user/v1/materialQuote/createMaterialQuote', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 更新材质报价
export const updateMaterialQuote = async (paylaod?: any) => {
  return await post('/user/v1/materialQuote/updateMaterialQuote', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 删除材质报价
export const deleteMaterialQuote = async (paylaod?: any) => {
  return await post('/user/v1/materialQuote/deleteMaterialQuote', paylaod)
    .then((res) => res)
    .catch(() => false)
}
// 材质报价列记录表
export const findMaterialQuoteRecordPage = async (paylaod?: any) => {
  return await get('/user/v1/materialQuote/findMaterialQuoteRecordPage', paylaod)
    .then((res) => res)
    .catch(() => false)
}
